package com.oyo.common.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.ToString;

import java.util.Arrays;

/**
 * 支付类型
 */
@Getter
@ToString
@RequiredArgsConstructor
public enum PayType {
    ADVANCE_PAY(0, "预付"),
    DEPOSIT_PAY(1, "现付");
    private final Integer code;
    private final String name;

    public static PayType parse(Integer code) {
        return Arrays.stream(values()).filter(item -> item.code.equals(code))
                .findFirst().orElse(null);
    }
}
